package com.ihr360.payroll.model.dto.salary.basecode;

import com.ihr360.commons.model.dto.BaseCode;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.Column;
import javax.persistence.Entity;

/**
 * 薪酬字段分类(大类)
 * 基础收入项
 * 福利项
 * 税费项
 * 报销项
 * 其他成本项
 * 考勤项
 * 统计项
 * 其他项
 */
@Entity
@Cache(region = "cnb.base", usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class SalaryFieldCategory extends BaseCode<Long> {

    private static final long serialVersionUID = 6787808837558270303L;
    private static final String BENIFIT_CATEGORY_CODE = "BENIFIT";

    /**
     * 是否支持自定义字段
     */
    private boolean customizable = true;

    @Column(columnDefinition = "bit(1) default 0")
    private boolean embedded;

    public boolean isCustomizable() {
        return customizable;
    }

    public void setCustomizable(boolean customizable) {
        this.customizable = customizable;
    }

    public boolean isBenifitCategory() {
        return BENIFIT_CATEGORY_CODE.equals(this.getCode());
    }
}